<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>文档列表</title>
<meta http-equiv="Content-Language" content="en-us" /> 
<meta name="keywords" content="dhtml grid, AJAX grid, frozen column, fixed column " >
<meta name="description" content="How to specify column to be frozen or unfrozen" >

<#-- 考虑进行include 进行来-->
<link rel="stylesheet" type="text/css" media="all" href="/static/grid/calendar/calendar-blue.css"  />
<script type="text/javascript" src="/static/grid/calendar/calendar.js"></script>
<script type="text/javascript" src="/static/grid/calendar/calendar-cn-utf8.js"></script>
<script type="text/javascript" src="/static/grid/calendar/calendar-setup.js"></script>

<link rel="stylesheet" type="text/css" href="/static/grid/gt_grid.css" />
<link rel="stylesheet" type="text/css" href="/static/grid/skin/vista/skinstyle.css" />
<script type="text/javascript" src="/static/grid/gt_msg_cn.js"></script>
<#--
<script type="text/javascript" src="../static/grid/gt_const.js"></script>
-->
<script type="text/javascript" src="/static/grid/gt_grid_all.js"></script>
<script type="text/javascript" src="/static/grid/flashchart/fusioncharts/FusionCharts.js"></script>

<script type="text/javascript" >

var grid_demo_id = "myGrid1" ;

var dsOption= {

	fields :[
		{name : 'id' ,type:'int' },
		{name : 'name',type: 'string'  },
		{name : 'companylevel',type: 'string'  }
	],
	recordType : 'object'
	//uniqueField : 'id'
}
var colsOption = [
		{id: 'chk' ,isCheckColumn : true, _checkType:'radio' ,frozen : false , filterable : false, header: "", title: "全选" , fieldName : 'id'},
		{id: 'id' , header: "id" , width :60 },
		{id: 'name' , header: "名称" , width :150 ,editable:true , 
			editor: { type :'text' ,validRule : 'R' }
		},
		{id: 'companylevel' , header: "companylevel" , width :50 ,editable:true 
		}
		
 ];

var gridOption={

	//autoSaveOnNav : true ,
	//reloadAfterSave : false, 
	id : grid_demo_id,

	/* loadURL 支持函数, 该函数返回值是response对象 传递栏目id值 */
	loadURL : 'http://localhost:8085/company/list',
	saveURL : 'http://localhost:8085/company/save' ,
	replaceContainer : true,
	//remotePaging : true,

	width: "865",  //"100%", // 700,
	height: "420",  //"100%", // 330,

	container : 'mygrid_container',

	toolbarPosition : 'bottom', // 'top',  工具条显示的位置, 暂时不支持上下都显示.
	toolbarContent : 'nav | pagesize | reload | add del save | filter | print | state',
	pageSize :  40 ,
	pageSizeList : [40,60,80,100,200],

	dataset : dsOption ,

	columns : colsOption ,
	
	recountAfterSave : true, 
	
	defaultRecord :
	{'name':"liangqz"},
	//传递参数
	parameters : { channelId:1,isLeaf:2,cc:[8,9] },
	
	//下面两个设置复选框，可以获取多条记录进行操作
	multiSelect : true,
	
	selectRowByCheck :true,

	beforeSave : function(reqParam,grid){
		//confirm("您确定要提交如下数据到 "+grid.saveURL + " 吗?\n "+GT.toJSONString(reqParam,true)+"\n");
		return confirm("您确定要提交吗?");
		
	}

};

//var mygrid = new Sigma.Grid( gridOption );

//Sigma.Utils.onLoad( function(){
//	mygrid.render();
//} );

var mygrid=new Sigma.Grid( gridOption );
Sigma.Util.onLoad( Sigma.Grid.render(mygrid) );

//////////////////////////////////////////////////////////
//测试查询
function query() {
	var param={
		name : Sigma.Util.getValue(Sigma.$('q_name'))
	}
	alert( "在查询数据的request中, 将会有如下参数:\n\n"+Sigma.toQueryString(param) );
	alert(mygrid.query);
	mygrid.query(param);
}

</script>

 <script type="text/javascript" > 
 //测试过滤
function doFilter(){
   alert(Sigma.Util.getValue(Sigma.$('q_companylevel')));
   var filterInfo=[
	   {
	      fieldName : "name",
	      logic : "startWith",
	      value : Sigma.Util.getValue(Sigma.$('q_name'))
	   }
   ]
   var grid=Sigma.$grid("myGrid1");
   var rowNOs = grid.applyFilter(filterInfo);
   //var grid = Sigma.$grid("myGrid1");
   //alert(grid);
   //var rowNOs = grid.filterGrid(filterInfo); 
}
 
 function doUnfilter(){
    var grid = Sigma.$grid("myGrid1");
    var rowNOs=grid.applyFilter([]);
 
}
</script>


</head>
<body style="padding:0px;margin:0px;">
	<form name="queryForm" >
			<div>
					姓名:00000000000000000000
					<input type="text" name="name" value="liang" id="q_name">
					<!-- 
					<select id="f_logic1"> 
						<option value="equal">=</option> 
						<option value="notEqual">!=</option> 
						<option value="less">&lt;</option> 
						<option value="great">></option> 
						<option value="lessEqual">&lt;=</option> 
						<option value="greatEqual">>=</option> 
						<option value="like" selected>like</option> 
						<option value="startWith">startWith</option> 
						<option value="endWith">endWith</option> 
					</select>
					-->
					<input type="text" name="companylevel" value="3" id="q_companylevel">
					
					<input type="button" class="gt-input-button" value="查询" onclick="doFilter();" />
					<input type="button" class="gt-input-button" value="查询" onclick="doUnfilter();" />
					<input type="reset" class="gt-input-button"/>
			
			</div>
		</form>
	<div id="mygrid_container" style="border:0px solid #cccccc;background-color:#f3f3f3;padding:5px;width:95%;">
		
		
	</div>
	
</body>
</html>